package com.adee.nowcoder.huawei;

import java.util.Scanner;

public class T030_HJ030 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextLine()) { // 注意 while 处理多个 case
            String str = in.nextLine();
            String[] split = str.trim().split(" ");
            char[] arr = (split[0] + split[1]).toCharArray();
            for(int i = arr.length-1; i >= 0; i-=2) {
                for (int j = 0; j < i - 1; j += 2) {
                    if (arr[j] > arr[j + 2]) {
                        char tmp = arr[j + 2];
                        arr[j + 2] = arr[j];
                        arr[j] = tmp;
                    }
                }
                for (int j = 1; j < i - 1; j += 2) {
                    if (arr[j] > arr[j + 2]) {
                        char tmp = arr[j + 2];
                        arr[j + 2] = arr[j];
                        arr[j] = tmp;
                    }
                }
            }
            for (int i = 0; i < arr.length; i++) {
                arr[i] = shift(arr[i]);
            }
            System.out.println(new String(arr));
        }
    }

    static char shift(char c) {
        int a = 0;
        if (c >= '0' && c <= '9') {
            a = (c-'0') & 0xf;
        }else if (c >= 'A' && c <= 'F') {
            a = (c-'A'+10) & 0xf;
        }else if (c >= 'a' && c <= 'f') {
            a = (c-'a'+10) & 0xf;
        }else {
            return c;
        }
        String s = "000" + Integer.toBinaryString(a);
        String sub = s.substring(s.length() - 4);
        StringBuilder sb = new StringBuilder();
        int len = sub.length();
        for (int i = 0; i < len; i++) {
            sb.append(sub.charAt(len-1-i));
        }
        int i = Integer.parseInt(sb.toString(), 2);
        String h = Integer.toHexString(i).toUpperCase();
        return h.charAt(h.length()-1);
    }
}
